
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>go的api接口实现 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../alipay/" />
    
    
    <link rel="prev" href="go的mysql操作.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    Part2 模拟商城
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="payflow.html">
            
                <a href="payflow.html">
            
                    
                    订单支付流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="goinstall.html">
            
                <a href="goinstall.html">
            
                    
                    go 语言环境安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="gomod.html">
            
                <a href="gomod.html">
            
                    
                    包管理工具 go mod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="http.html">
            
                <a href="http.html">
            
                    
                    实现http服务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="http静态资源服务器.html">
            
                <a href="http静态资源服务器.html">
            
                    
                    http静态资源服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="mysql表设计.html">
            
                <a href="mysql表设计.html">
            
                    
                    mysql表设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="go的mysql操作.html">
            
                <a href="go的mysql操作.html">
            
                    
                    go的mysql操作
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.8" data-path="go的api接口实现.html">
            
                <a href="go的api接口实现.html">
            
                    
                    go的api接口实现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../alipay/">
            
                <a href="../alipay/">
            
                    
                    Part3 接入支付宝
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../alipay/flow.html">
            
                <a href="../alipay/flow.html">
            
                    
                    支付宝文档
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../alipay/secret.html">
            
                <a href="../alipay/secret.html">
            
                    
                    密码学-非对称加密
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">扩展</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../plugins.md">
            
                <span>
            
                    
                    插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../themes.md">
            
                <span>
            
                    
                    主题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../bookjson.md">
            
                <span>
            
                    
                    bookjson
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >go的api接口实现</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="go&#x7684;api&#x63A5;&#x53E3;&#x5B9E;&#x73B0;">go&#x7684;api&#x63A5;&#x53E3;&#x5B9E;&#x73B0;</h2>
<p>&#x73B0;&#x5728;&#x8981;&#x662F;&#x7528;go&#x5B8C;&#x6210;&#x4E00;&#x4E9B;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x7684;&#x5F00;&#x53D1;&#x3002;web&#x6846;&#x67B6;&#x5927;&#x90E8;&#x5206;&#x662F;&#x57FA;&#x4E8E;MVC&#x7684;&#xFF0C;&#x6211;&#x4EEC;&#x8FD9;&#x91CC;&#x4F7F;&#x7528;&#x4E86;&#x539F;&#x751F;&#x7684;net/http&#x5305;&#xFF0C;&#x4F46;&#x662F;&#x4E5F;&#x8981;&#x4E25;&#x683C;&#x6309;&#x7167;MVC&#x67B6;&#x6784;&#x6765;&#x3002;</p>
<h3 id="mvc-&#x6A21;&#x5F0F;">MVC &#x6A21;&#x5F0F;</h3>
<p>MVC&#x6A21;&#x5F0F;&#x662F;&#x628A;&#x7A0B;&#x5E8F;&#x5206;&#x4E3A;&#x4EE5;&#x4E0B;&#x4E09;&#x4E2A;&#x90E8;&#x5206;&#xFF1A;</p>
<ul>
<li>&#x63A7;&#x5236;&#x5668;&#xFF08;Controller&#xFF09;&#xFF1A;&#x8D1F;&#x8D23;&#x8F6C;&#x53D1;&#x8BF7;&#x6C42;&#xFF0C;&#x5BF9;&#x8BF7;&#x6C42;&#x8FDB;&#x884C;&#x5904;&#x7406;&#x3002;</li>
<li>&#x89C6;&#x56FE;&#xFF08;View&#xFF09;&#xFF1A;&#x754C;&#x9762;&#x8BBE;&#x8BA1;&#x4EBA;&#x5458;&#x8FDB;&#x884C;&#x56FE;&#x5F62;&#x754C;&#x9762;&#x8BBE;&#x8BA1;&#x3002;</li>
<li>&#x6A21;&#x578B;&#xFF08;Model&#xFF09;&#xFF1A;&#x7A0B;&#x5E8F;&#x5458;&#x7F16;&#x5199;&#x7A0B;&#x5E8F;&#x5E94;&#x6709;&#x7684;&#x529F;&#x80FD;&#xFF08;&#x5B9E;&#x73B0;&#x7B97;&#x6CD5;&#x7B49;&#x7B49;&#xFF09;&#x3001;&#x6570;&#x636E;&#x5E93;&#x4E13;&#x5BB6;&#x8FDB;&#x884C;&#x6570;&#x636E;&#x7BA1;&#x7406;&#x548C;&#x6570;&#x636E;&#x5E93;&#x8BBE;&#x8BA1;&#xFF08;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x5177;&#x4F53;&#x7684;&#x529F;&#x80FD;&#xFF09;&#x3002;</li>
</ul>
<p><img src="../assets/images/MVC&#x6A21;&#x5F0F;.png" alt="MVC&#x6A21;&#x5F0F;"></p>
<p>&#x800C;&#x73B0;&#x5728;&#x6D41;&#x884C;&#x7684;&#x524D;&#x540E;&#x7AEF;&#x5206;&#x79BB;&#x9879;&#x76EE;&#xFF0C;&#x628A;View&#x5C42;&#x62BD;&#x5230;&#x4E86;&#x524D;&#x7AEF;&#x6765;&#x505A;&#xFF0C;&#x540E;&#x7AEF;&#x4E3B;&#x8981;&#x662F;M&#x548C;C&#x5C42;&#x3002;</p>
<p><img src="../assets/images/&#x524D;&#x540E;&#x7AEF;&#x5206;&#x79BB;.png" alt="&#x524D;&#x540E;&#x7AEF;&#x5206;&#x79BB;"></p>
<p>&#x5176;&#x4E2D;model&#x88AB;&#x62C6;&#x5206;&#x6210;&#x4E86;page service &#x548C; data service &#x4E24;&#x5C42;&#xFF0C;data service &#x5B9E;&#x9645;&#x5BF9;&#x63A5;&#x4E86;mysql&#x5185;&#x5355;&#x8868;&#x7684;&#x64CD;&#x4F5C;&#xFF0C;&#x800C;page service&#x662F;&#x5BF9;data service&#x7684;&#x7EC4;&#x5408;&#x4EE5;&#x53CA;&#x76F8;&#x5173;&#x7684;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#x5904;&#x7406;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x5C31;&#x6309;&#x8FD9;&#x4E2A;&#x89C4;&#x5219;&#x8FDB;&#x884C;&#x4EE3;&#x7801;&#x7ED3;&#x6784;&#x7684;&#x8BBE;&#x8BA1;&#x3002;</p>
<h3 id="json&#x6570;&#x636E;&#x5904;&#x7406;">json&#x6570;&#x636E;&#x5904;&#x7406;</h3>
<p>go&#x6807;&#x51C6;&#x5E93; &#x63D0;&#x4F9B;&#x4E86;json&#x7684;&#x5904;&#x7406;&#x5305;&#xFF0C; encoding/json </p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="go的mysql操作.html" class="navigation navigation-prev " aria-label="Previous page: go的mysql操作">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../alipay/" class="navigation navigation-next " aria-label="Next page: Part3 接入支付宝">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"go的api接口实现","level":"1.2.8","depth":2,"next":{"title":"Part3 接入支付宝","level":"2.1","depth":1,"path":"alipay/README.md","ref":"alipay/README.md","articles":[{"title":"支付宝文档","level":"2.1.1","depth":2,"path":"alipay/flow.md","ref":"alipay/flow.md","articles":[]},{"title":"密码学-非对称加密","level":"2.1.2","depth":2,"path":"alipay/secret.md","ref":"alipay/secret.md","articles":[]}]},"previous":{"title":"go的mysql操作","level":"1.2.7","depth":2,"path":"two_shop/go的mysql操作.md","ref":"two_shop/go的mysql操作.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"two_shop/go的api接口实现.md","mtime":"2020-05-30T09:20:33.578Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-05-30T14:47:16.991Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

